﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using VanTaiData;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsControllertb_UserPermiss : clsConnect
    {
        private clsConnect cls = new clsConnect();
        #region[Get-Data]
        public DataTable BindGridUserPermiss()
        {
            return cls.BindGridData("sp_TM_UserPermiss");
        }
        public DataTable BindGridUserPermissDetail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TM_UserPermiss_Detail_Edit","@Id", id);
        }
        public DataTable BindGridUserPermissFillter(int id)
        {
            return cls.LayDuLieuParameter("sp_TM_UserPermiss_Fillter", "@Id", id);
        }
        public DataTable BindGridUserPermissDel(int id)
        {
            return cls.LayDuLieuParameter("sp_TM_UserPermiss_Delete","@UserPerID", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertRoles(clsTMUserPermissProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@RolesID", data.RolesID);
            cls.AddParameter("@PermissFuncID", data.PermissFuncID);
            cls.AddParameter("@PermisstionNumber", data.PermisstionNumber);
            cls.AddParameter("@AddNew", data.AddNew);
            cls.AddParameter("@Edit", data.Edit);
            cls.AddParameter("@Delete", data.Delete);
            cls.AddParameter("@Review", data.Review);
            cls.AddParameter("@Is_Page", data.Is_Page);
            cls.ExecuteNonQuery("sp_TM_UserPermiss_Insert");
            return true;
        }
        public bool UpdateRoles(clsTMUserPermissProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@UserPerID", data.UserPerID);
            cls.AddParameter("@PermisstionNumber", data.PermisstionNumber);
            cls.AddParameter("@AddNew", data.AddNew);
            cls.AddParameter("@Edit", data.Edit);
            cls.AddParameter("@Delete", data.Delete);
            cls.AddParameter("@Review", data.Review);
            cls.AddParameter("@Is_Page", data.Is_Page);
            cls.ExecuteNonQuery("sp_TM_UserPermiss_Update");
            return true;
        }
        public bool DeleteRoles(int id_1)
        {
            cls.Delete("sp_TM_UserPermiss_Delete", "@UserPerID", id_1);
            return true;
        }
        #endregion

        #region[Search]
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TM_UserPermiss_Search", "@KEYWORDS", keywords);
        }
        public DataTable Fillter(int id)
        {
            return cls.LayDuLieuParameter("sp_TM_UserPermiss_Fillter_Func", "@PermissFuncID", id);
        }
        #endregion
    }
}
